<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>登录</title>
    <link href="./admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="./admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="./admin/css/animate.css" rel="stylesheet">
    <link href="./admin/css/style.css" rel="stylesheet">
    <link href="./admin/css/login.css" rel="stylesheet">
    <script type="text/javascript" src="./admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="./admin/js/layer/layer.js"></script>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">
                    <!-- <div class="logopanel m-b">
                        <h1>登录</h1>
                    </div>
                    <div class="m-b"></div> -->
<!--                     <h4>欢迎使用 <strong>H+ 后台主题UI框架</strong></h4>
                    <ul class="m-b">
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
                    </ul> -->
                    <!-- <strong>还没有账号？ <a href="#">立即注册&raquo;</a></strong> -->
                </div>
            </div>
            <div class="col-sm-5">
                <form method="post" class="m-t">
                    <h4 class="no-margins">登录：</h4>
                    <input type="text" class="form-control uname" name="uname" placeholder="用户名" />
                    <input type="password" class="form-control pword m-b" name="pword" placeholder="密码" />
                    <button class="btn btn-success btn-block">登录</button>
                    <meta name="csrf-token" content="{{ csrf_token() }}">
                </form>
            </div>
        </div>
    </div>
    <script>
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            //墨绿深蓝风
            //layer.msg('玩命提示中');
            
            $(".m-t").submit(function(e){
                var uname = $("input[name='uname']").val();
                var pword = $("input[name='pword']").val();

                if(!uname){
                    layer.msg('请填写用户名');
                    return false;
                }

                if(!pword){
                    layer.msg('请填写密码');
                    return false;
                }           

                $.ajax({
                    url:"/login_do",    //请求的url地址
                    dataType:"json",   //返回格式为json
                    data:{"username":uname,"password":pword},    //参数值
                    type:"POST",   //请求方式
                    success:function(req){
                        //请求成功时处理
                        if(req.status == 0){
                            layer.msg(req.message);
                            return false;
                        }
                           
                        self.location='/index';
                    }
                });

                return false;
            });
    </script>
</body>

</html>
